// 设置属性

function deepClone(orgain, target) {
	var target = target || {};
	var string = Object.prototype.toString;
	var arrType = "[object Array]";
	for (var key in orgain) {
		if (orgain.hasOwnProperty(key)) {
			if (typeof orgain[key] == "object" && orgain[key] !== null) {
				if (string.call(orgain[key]) == arrType) {
					target[key] = [];
				} else {
					target[key] = {};
				}
				deepClone(orgain[key], target[key]);
			} else {
				target[key] = orgain[key];
			}
		}
	}
	return target
}

function useData(data) {
	const _data = deepClone(data);

	function setData(key, value) {
		_data[key] = value;
	}

	return [_data, setData];
}
export default useData;